import 'package:seedfour/generated/json/base/json_field.dart';
import 'package:seedfour/generated/json/invoice_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class InvoiceEntity {
  String? withdrawMode;
  String? withdrawAcct;
  String? withdrawBank;
  String? withdrawName;
  String? orderRemark;
  InvoiceOrderAttach? orderAttach;
  List<InvoiceOrderAttach>? orderAttachs;
  List<InvoiceRelateCases>? relateCases;
  List<InvoiceItemEntity>? invoiceList;

  InvoiceEntity();

  factory InvoiceEntity.fromJson(Map<String, dynamic> json) =>
      $InvoiceEntityFromJson(json);

  Map<String, dynamic> toJson() => $InvoiceEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class InvoiceOrderAttach {
  String? name;
  String? url;

  InvoiceOrderAttach({this.name, this.url});

  factory InvoiceOrderAttach.fromJson(Map<String, dynamic> json) =>
      $InvoiceOrderAttachFromJson(json);

  Map<String, dynamic> toJson() => $InvoiceOrderAttachToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class InvoiceRelateCases {
  String? caseId;
  String? caseName;
  String? time;

  InvoiceRelateCases({this.caseId, this.caseName, this.time});

  factory InvoiceRelateCases.fromJson(Map<String, dynamic> json) =>
      $InvoiceRelateCasesFromJson(json);

  Map<String, dynamic> toJson() => $InvoiceRelateCasesToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class InvoiceItemEntity {
  late String invoiceNo = '';
  late String name = '';
  late String source = '';
  late String cat1 = '';
  late String cat2 = '';
  late String sfUrl = '';
  late String url = '';
  late String totalAmount = '';

  InvoiceItemEntity();

  factory InvoiceItemEntity.fromJson(Map<String, dynamic> json) =>
      $InvoiceItemEntityFromJson(json);

  Map<String, dynamic> toJson() => $InvoiceItemEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
